<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>私信界面</title>
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/js/plugins/comments-master/css/index.css">
    <link rel="stylesheet" href="/js/plugins/dialog/dialog.css">
    <link rel="stylesheet" href="/css/strategyComment.css"/>
    <script src="/js/plugins/jrender/jrender.js"></script>
    <link rel="stylesheet" href="/js/plugins/jquery-confirm/css/jquery-confirm.css">
    <script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>
    <script src="/js/plugins/dialog/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <script src="/js/plugins/jquery-form/jquery.form.js"></script>
</head>
<script>
    $(function () {
        //拿到地址栏上面的被私信的用户Id
        var id = getParams().id;

        //拿到当前登录的用户，要求必须登录之后才能评论
        var currentuser ;
        currentuser = JSON.parse(sessionStorage.getItem("user"));

        //给发送按钮绑定点击事件
        $("#go").click(function () {
            $("#uid").val(id);//将被私信的用户id携带到后台
            $("#cid").val(currentuser.id);//将发私信的用户id携带到后台
            $("#goEditm").ajaxSubmit(function (data) {
                if(data.success){
                    alert("发送成功！");
                    window.location.href="/index.html";
                }else{
                    alert("不知道什么原因，发送失败了");
                }
            })
        })
    })
</script>
<body>
<div style = "width: 610px;height: 509px;background-color: #f9f9f9;">
    <div style = "width: 100%;height: 83px;text-align: center;">
        <h1 style="padding-top: 20px; text-align: center">请自行脑补华丽的页面</h1>
    </div>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <div style="width: 100%;height: 426px;background-color: #ffffff;padding-left: 35px;padding-right: 35px;">
        <form id="goEditm" action="/sms" method="post" enctype="multipart/form-data">

            <input type="hidden" name="user.id" id="uid">
            <input type="hidden" name="currentuser.id" id="cid">

            标题：<input type="text" name="title"><br>
            <p></p>
            内容：<textarea rows="3" cols="20" name="content"></textarea>
            <p></p>
            附加图片：<input type="file" name="pic" accept="image/*"/><br>
            <p></p>
            <input type="button" id="go" value="发送">
        </form>
    </div>
</div>

</body>
</html>